#include <stdio.h>
#include <stdint.h>
#define roundUpTo4(v) ((v+4-1) - ((v+4-1)&3))
#define roundUpTo8(v) ((v+8-1) - ((v+8-1)&7))
#define roundUpTo16(v) ((v+16-1) - ((v+16-1)&15))
#define roundUpTo32(v) ((v+32-1) - ((v+32-1)&31))
#define roundUpTo4096(v) ((v+4096-1) - ((v+4096-1)&4095))

char data[]={0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x30};

static inline uint16_t read16(void *addr) {
    return *((uint16_t *)addr);
}

static inline uint32_t read32(void *addr) {
    return *((uint32_t *)addr);
}

static inline uint64_t read64(void *addr) {
    return *((uint64_t *)addr);
}

int main(int argc, char** argv)
{
    printf("hello world!\n");
	for(int i=4095;i<4095+12;i++)
	{
		int val=i;
		int val2=roundUpTo8(val);
		int val3=roundUpTo16(val);
		int val4=roundUpTo4096(val);				
		printf("val=%d,val2=%d,val3=%d,val4=%d\n",val,val2,val3,val4);
	}
	void* addr=(&data+1);
	
	uint16_t v16=read16(addr);
	printf("v16=%d\n",v16);
	
	uint32_t v32=read32(addr);
	printf("v32=%d\n",v32);
	
	uint64_t v64=read64(addr);
	printf("v64=%d\n",v64);
	
	
	
    return 0;
}
